package com.xcity.game.shop;

import com.xcity.game.item.ItemTemplate;

import naga.x.App;
import naga.x.game.template.Template;
import naga.x.game.template.TemplateException;
import naga.x.game.template.TemplateService;

public abstract class AbstractShopTemplate extends Template {

	/** 数量 */
	protected int count;

	/** 出售价格 */
	protected int price;
	
	protected ItemTemplate item;

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}
	
	public ItemTemplate getItemTemplate() {
		return item != null ? item : (item = App.getApp().getServiceManager().get(TemplateService.class).get(ItemTemplate.class, id));
	}
	
	public abstract String getUniqueId();

	@Override
	public void validate() throws TemplateException {
	}

}
